<!--
 * @Author: Sam
 * @Date: 2020-10-22 11:51:41
 * @LastEditTime: 2021-02-24 11:00:45
 * @LastEditors: Ken
 * @Description: 
 * @FilePath: \resourcesd:\vscode\ygboost-eui\src\components\app\edit\waybill\customerevaluation\replycustomerEdit.vue
 * @可以输入预定的版权声明、个性签名、空行等
-->
<template>
  <div class="padding-lr-xl ">
     <el-table
    :data="tableData"
    stripe
    style="width: 100%">
    <el-table-column
      prop="record"
      label="回复内容"
      width="680">
    </el-table-column>
    <el-table-column
      prop="cuser"
      label="回复人"
      >
    </el-table-column>
    <el-table-column
      prop="cdate"
      label="回复时间"
      >
    </el-table-column>
  </el-table>
  

 
    <el-input v-model.trim="input" prop="text" placeholder="请输入回复内容" style="margin-top:30px;"></el-input>
    <div class="text-left margin-top">
      <el-button type="primary" size="mini" @click="save">提交</el-button>
    </div>
 
  </div>
  
  
</template>


<script>
import { ajax } from "@/store/yg/common/utils";
  export default {
     props: [
  　　'row', 'data', 'more'
　],
    data() {
      return {
        input: '',
        tableData: []
      }
    },
    created() {
      
    },
    mounted() {
      console.log("cx:",this.$store.state.edit);
      console.log("cx:",this.$store.state.edit.row.id);
      this.init()
    },
    
    methods: {
      async init() {
 
        const data = await ajax('chatrecordlist',{id:this.$store.state.edit.row.id})
        this.tableData = data;
        
      },
    //       callbefore() {
    //   this.$store.state.edit.row = this.input;
    //   console.log("submit", this.$store.state.edit.row);
    // },
    async save() {

      if(!this.input){
         this.$message({
            message:'请输入回复内容',
            
          })
        return;
      }


        const {code,message} = await ajax('replycustomer',{id:this.$store.state.edit.row.id,text:this.input})
        if(code === 200){
          this.$message({
            message:'提交成功！',
            type: 'success'
          })
          this.input = ''
          this.init()
        }else {
          this.$message.error(message)
        }
    }
    }
  }
</script>


